// 封装用户相关的接口
import type { LoginParams, LoginRes, UserInfoRes } from '@/types/user'
import { request } from '@/utils/request'

// 登录接口
export const loginAPI = (params: LoginParams) => {
  return request<LoginRes>('/v1_0/authorizations', 'post', params)
}

// 获取用户信息
export const getUserInfoAPI = () => {
  return request<UserInfoRes>('/v1_0/user/profile', 'get')
}
// 更新用户头像
export const updateUserPhotoAPI = (file: FormData) => {
  return request<{photo:string}>('/v1_0/user/photo', 'PATCH', file)
}
// 更新用户信息
export const updateUserInfoAPI = (data: UserInfoRes) => {
  return request('/v1_0/user/profile', 'PATCH', data)
}